The section describes the programming interface of the WDOG Peripheral driver.
More...
Overview
The WDOG driver is used to configure WDOG. It provides an easy way to make necessary module initializations and configure WDOG.
Initialization
To initialize the WDOG module, call
wdog_init() and pass in the initialization data structure. This function enables the WDOG module and clock automatically.
After
wdog_init() is called, the WDOG is enabled and its count is working, so
wdog_refresh() should be called before WDOG times out.This is example code for initializing and configuring the driver:
const wdog_init_t wdogInit =
{
.timeOutValue = 2048,
.wdogCallbackFunc = NULL,
.updateRegisterEnable = true,
.cpuWaitModeEnable = true,
.cpuStopModeEnable = true,
};
WDOG_init(&wdogInit);
WDOG Refresh
After WDOG is enabled, the
wdog_refresh() should be called periodically to prevent the WDOG from timing out, or a RESET will assert. This is called "Feed Dog".
WDOG Reset Count
The WDOG can record the reset count caused by WDOG timeout.
- wdog_get_reset_count() gets the reset count caused by WDOG timeout.
- wdog_clear_reset_count() clears the reset count caused by WDOG timeout.
Reset Chip
The WDOG can be used to reset the chip.
- wdog_reset_chip() is used to reset the chip whether the WDOG is enabled or not.